<template>
  <el-container>
    <el-header>Header</el-header>
    <el-container>
      <el-aside width="200px">
        <el-aside width="200px" style="background-color: rgb(238, 241, 246)">
    <el-menu :default-openeds="['1']">
      <el-submenu index="1">
        <template v-slot:title><i class="el-icon-message"></i>可用导航</template>
        <el-menu-item-group >
          <el-menu-item index="1-1" v-on:click="to_url('showImg')">显示图片(默认页面)</el-menu-item>
          <el-menu-item index="1-2" v-on:click="to_url('showTable')">显示表格</el-menu-item>
          <el-menu-item index="1-3" v-on:click="to_url('search')">天气(默认页面)</el-menu-item>
          <el-menu-item index="1-4" v-on:click="to_url('select')">选择(默认页面)</el-menu-item>
          <el-menu-item index="1-2" v-on:click="to_url('login')">退出</el-menu-item>
        </el-menu-item-group>
      </el-submenu>

      <el-submenu index="2">
        <template v-slot:title><i class="el-icon-menu"></i>导航二</template>
        <el-menu-item-group>
          <template v-slot:title>分组一</template>
          <el-menu-item index="2-1">选项1</el-menu-item>
          <el-menu-item index="2-2">选项2</el-menu-item>
        </el-menu-item-group>
        <el-menu-item-group title="分组2">
          <el-menu-item index="2-3">选项3</el-menu-item>
        </el-menu-item-group>
        <el-submenu index="2-4">
          <template v-slot:title>选项4</template>
          <el-menu-item index="2-4-1">选项4-1</el-menu-item>
        </el-submenu>
      </el-submenu>
    </el-menu>
  </el-aside>

      </el-aside>
      <el-container>
        <el-main>
          <router-view/>
        </el-main>
      </el-container>
    </el-container>
      <el-container>
        <el-footer>Footer</el-footer>
    </el-container>
  </el-container>
</template>

<script>
export default {
  name: 'main',
  data () {
    return {
      msg: 'Welcome to Your Vue.js App'
    }
  },
  methods: {
    to_url: function (url) {
      this.$router.push({ name: url })
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
 .el-header, .el-footer {
    background-color: #B3C0D1;
    color: #333;
    text-align: center;
    line-height: 60px;
  }

  .el-aside {
    background-color: #D3DCE6;
    color: #333;
    text-align: center;
    line-height: 200px;
  }

  .el-main {
    background-color: #E9EEF3;
    color: #333;
    text-align: center;
    line-height: 300px;
  }

  body > .el-container {
    margin-bottom: 40px;
  }

</style>
